<!-- 弹窗组件 -->
<script>
export default {
  props: {
    // * 弹窗开关
    dialogVisible: {
      type: Boolean,
      default: false,
    },
    // * 是否展示footer按钮
    footer: {
      type: Boolean,
      default: true,
    },
    // * 取消按钮文本
    cancelBtnText: {
      type: String,
      default: "取 消",
    },
    // * 提交按钮文本
    confirmBtnText: {
      type: String,
      default: "确 定",
    },
    // * footer样式名称
    footerClassName: {
      type: String,
      default: "",
    },
    // * 提交按钮禁止点击
    confirmDisabled: {
      type: Boolean,
      default: () => false,
    },
    destroyOnClose: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {};
  },
};
</script>

<template>
  <el-dialog
    :close-on-click-modal="false"
    :close-on-press-escape="false"
    :destroy-on-close="destroyOnClose"
    v-bind="$attrs"
  >
    <slot name="body"></slot>
    <div slot="footer" :class="['dialog-footer', footerClassName]">
      <template v-if="footer">
        <el-button
          type="primary"
          class="cancel-btn"
          @click="$emit('close-dialog')"
          >{{ cancelBtnText }}</el-button
        >
        <el-button
          type="primary"
          class="submit-btn"
          :disabled="confirmDisabled"
          @click="$emit('confirm-dialog')"
          >{{ confirmBtnText }}</el-button
        >
      </template>
    </div>
  </el-dialog>
</template>

<style lang="scss">
.el-dialog {
  width: 50%;
  border-radius: 6px;
  .el-dialog__header {
    text-align: left;
    font-size: 16px;
    font-weight: 700;
  }
  .el-dialog__body {
    padding: 20px;
  }
  button.cancel-btn,
  button.submit-btn:not(.el-button--small) {
    padding: 0;
    height: 32px;
    line-height: 1;
    width: 60px;
    font-size: 14px;
  }

  button.cancel-btn {
    width: 60px;
    color: #212121;
    background-color: #e7e7e7;
    border-color: #e7e7e7;
  }
  button.submit-btn {
    color: #ffffff;
    background-color: #00a1d6;
    border-color: #00a1d6;
  }
  button.submit-btn.is-disabled,
  button.submit-btn.is-disabled:hover,
  button.submit-btn.is-disabled:focus,
  button.submit-btn.is-disabled:active {
    background-color: #83dffd;
    border-color: #83dffd;
  }
  button.submit-btn:not(.el-button--small) {
    width: 86px;
  }
  button.submit-btn.el-button--small {
    height: 24px;
    line-height: 1;
    margin-left: 10px;
  }
  .el-form-item__content {
    text-align: left;
  }
  .el-upload-list--picture-card .el-upload-list__item,
  .el-upload--picture-card {
    width: 50px;
    height: 50px;
  }
  .el-upload--picture-card {
    line-height: 1;
    .el-icon-plus {
      line-height: 50px;
    }
  }
  .upload-tip {
    font-size: 12px;
    color: #a5a5a5;
  }
}
.approve-flow-dialog .el-dialog__header {
  text-align: center;
}
</style>
